package com.share.dao;

import com.share.domain.Student;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * author:caifan
 * date:2019/8/1
 */
@Repository
public class BaseDao<T> implements IBaseDao<T> {

    @Autowired
    private SessionFactory sessionFactory;

    private Session getSession() {
        return sessionFactory.getCurrentSession();
    }

    @Override
    public void save(T obj) {
        Session currentSession = getSession();
        currentSession.save(obj);
    }

    @Override
    public void update(T obj) {
        return ;
    }

    @Override
    public List<T> listQuery() {
        return null;
    }
}
